/**
 * 20090107 1144:Grady.Kao, created.
 */
package com.e885.spring;

import java.lang.reflect.Method;

import org.springframework.aop.MethodBeforeAdvice;

import com.e885.log.E885Logger;

/**
 * @author Grady.Kao
 * @version 1.0
 * @company E885 Group
 * @copyright Copyright (c) 2000-2009
 */

public class CommonLogBeforeAdvice implements MethodBeforeAdvice
{

	/* (non-Javadoc)
	 * @see org.springframework.aop.MethodBeforeAdvice#before(java.lang.reflect.Method, java.lang.Object[], java.lang.Object)
	 */
	public void before( Method method, Object[] args, Object target ) throws Throwable
	{
		E885Logger.springLog.debug( "====== run method " + method.getName() + "() start ======" );		
		E885Logger.springLog.debug( "execute logic:" + target );
		
		StringBuffer buffer = new StringBuffer();
		buffer.append( "Arguments:" );
		
		int length = args.length;
		
		if( length >= 1 )
			buffer.append( args[0] );
		
		for( int i = 1 ; i < length ; i++ )
		{
			buffer.append( "," );
			buffer.append( args[i] );
		}	
		
		if( length >= 1 )
			E885Logger.springLog.debug( buffer.toString() );
	}

}
